var searchv = new Vue({
	el: "#app",
	data:{
		s5,
		store:'',
		storeId:'',
	},
	computed:{
		
	},
	watch:{
		
	},
	created:function(){
		var searchUrl =window.location.href;
		var searchData =searchUrl.split("=");        //截取 url中的“=”,获得“=”后面的参数
		var searchText =decodeURI(searchData[1]);   //decodeURI解码
		this.storeId = searchText
	},
	mounted: function() {
		this.getProduct()
	},
	methods:{
		getProduct(){
			var that = this
			var lng = localStorage.getItem("lng")
			var lat = localStorage.getItem("lat")
			s5.initData({url:'/store',type:"post",data:{lat:lat,lng:lng,key_word:this.storeId}},(res)=>{
				var data = JSON.parse(res)
				that.store = data.data
				if (data.code != 200) {
					weui.confirm(data.msg, {
						title: '温馨提示',
						buttons: [{
							label: 'NO',
							type: 'default',
							onClick: function() {
								console.log('no')
							}
						}, {
							label: 'YES',
							type: 'primary',
							onClick: function() {
								window.location.href = 'index.html'
								console.log('yes')
							}
						}]
					});
				}
			})
		},
		toGoodsDetail(id){
			window.location.href = "store-detail.html?id="+id
		}
	}
})